package cn.coisini.api.view;

import cn.coisini.model.common.dtos.Result;
import cn.coisini.model.common.enums.ResultEnum;
import cn.coisini.model.dto.CategoryDto;
import cn.coisini.model.pojo.Article;
import cn.coisini.model.vo.QueryVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author xiangshaw
 * Description:
 */
@Tag(name = "文章视图接口API", description = "查询")
@RequestMapping("/api/v1/view/article")
@Validated
public interface ArticleViewControllerApi {
    /**
     * 文章 接口
     */
    @Operation(summary = "条件分页 文章列表查询")
    @PostMapping("/list")
    Result<Object> getArticleViewList(@RequestBody QueryVo queryVo);

    /**
     * 分类 接口
     */
    @Operation(summary = "条件分页 分类列表查询")
    @GetMapping("/category")
    Result<List<Map<String, Object>>> getCategoryViewList();

    /**
     * 推荐分类 接口
     */
    @Operation(summary = "推荐分类列表查询")
    @GetMapping("/rcategory")
    Result<List<Map<String, Object>>> getRecommendCategoryViewList();

    /**
     * 添加或取消推荐分类 Add or Cancel
     */
    @Operation(summary = "添加或取消推荐分类")
    @PutMapping("/recommend")
    Result<ResultEnum> updateRecommendCategory(@RequestBody CategoryDto categoryDto);

    /**
     * 根据文章id查询文章详情
     */
    @Operation(summary = "根据文章id查询文章详情")
    @GetMapping("/detail")
    Result<Article> getArticleViewDetail(@RequestParam("id") String id);
}
